package atguigu.shijianduanquchongbingleijia;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang3.StringUtils;


public class JdlVo {

	public static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public static SimpleDateFormat sdfShort = new SimpleDateFormat("yyyy-MM-dd");
	public static TimerHelper helper = new TimerHelper();
	
    private String equipmentName;
    private String start;
    private String end;
    private String able;
    private Date recordDate;
    

	public String getEquipmentName() {
        return equipmentName;
    }

    public void setEquipmentName(String equipmentName) {
        this.equipmentName = equipmentName;
    }

    public String getStart() {
        return start;
    }

    public void setStart(String start) {
    	if(this.recordDate != null) {
    		if(StringUtils.isNotBlank(start)) {
    			try {
					Date parse = sdf.parse(start);
					if(parse.before(helper.beginOfDay(recordDate))) {
						this.start = sdfShort.format(recordDate)+" 00:00:00";
					}else {
						this.start = start;
					}
				} catch (ParseException e) {
					e.printStackTrace();
				}
    		}else {
    			this.start = sdfShort.format(recordDate)+" 00:00:00";
    		}
    	}else {
    		this.start = start;
    	}
    }

    public String getEnd() {
        return end;
    }

    public void setEnd(String end) {
    	if(this.recordDate != null) {
    		if(StringUtils.isNotBlank(end)) {
    			try {
					Date parse = sdf.parse(end);
					if(parse.after(helper.endOfDay(recordDate))) {
						this.end = sdfShort.format(recordDate)+" 23:59:59";
					}else {
						this.end = end;
					}
				} catch (ParseException e) {
					e.printStackTrace();
				}
    		}else {
				this.end = sdfShort.format(recordDate)+" 23:59:59";
    		}
    	}else {
    		this.end = end;
    	}
    }

    public String getAble() {
        return able;
    }

    public void setAble(String able) {
        this.able = able;
    }

	public Date getRecordDate() {
		return recordDate;
	}

	public void setRecordDate(Date recordDate) {
		this.recordDate = recordDate;
	}

	
    
    
}